
import axios from "axios";
import { stringBaseURL } from "./urlconfig"


const service = axios.create({
    baseURL: stringBaseURL()
});


//请求拦截器---在axios 发起请求之前要做的事儿   aop思想~~
service.interceptors.request.use(config => {

    console.log("axios 发起请求之前 做点什么事儿~~");
    return config;
});


//响应拦截器
service.interceptors.response.use(async response => {

    console.log("axios 请求已经得到结果. 然后会发生点生么事儿~~");
    console.log(response.data);

    return response;

}, err => {
    return Promise.reject(err);
})






export default service;